package com.example.goukakuproject;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class GKVocabdetail extends Activity {
	int trinhDo = 0;
	int bai = 0;
	int soLuongTu = 0;
	int tuThu = 0;
	String tuVung ="";
	String chuHan = "";
	String nghia = "";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_gkvocabdetail);
		Intent callerIntent=getIntent();
		Bundle packageFromCaller = callerIntent.getBundleExtra("VocabTabIntent");
		bai = packageFromCaller.getInt("bai");
		trinhDo = packageFromCaller.getInt("trinhdo");
		tuThu = packageFromCaller.getInt("tuthu");
		soLuongTu = 40; // Cai nay sau se lay tu database
		tuVung = "Tu vung so " + tuThu; // Lay tu databse;
		chuHan = "Chu Han so " + tuThu;  // Lay tu databse;
		nghia = "Nghia cua tu so " + tuThu;  // Lay tu databse;
		final TextView tvTu = (TextView) findViewById(R.id.tvVocab);
		final TextView tvChuHan = (TextView) findViewById(R.id.tvKanji);
		final TextView tvNghia = (TextView) findViewById(R.id.tvMeaning);
		final TextView tvSoThuTu = (TextView) findViewById(R.id.txtVocabNo);
		tvTu.setText(tuVung);
		tvChuHan.setText(chuHan);
		tvNghia.setText(nghia);
		tvSoThuTu.setText(tuThu + "/" + soLuongTu);
		Button btnDanhSach = (Button) findViewById(R.id.btnBackToVocabList);
		Button btnPre = (Button) findViewById(R.id.btnVocabdetailPre);
		Button btnNext = (Button) findViewById(R.id.btnVocabdetailNext);
		btnDanhSach.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				finish();				
			}
		});	
		btnPre.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				if (tuThu == 1) return;
				tuThu = tuThu - 1;				
				tuVung = "Tu vung so " + tuThu; // Lay tu databse;
				chuHan = "Chu Han so " + tuThu;  // Lay tu databse;
				nghia = "Nghia cua tu so " + tuThu;  // Lay tu databse;				
				tvTu.setText(tuVung);
				tvChuHan.setText(chuHan);
				tvNghia.setText(nghia);
				tvSoThuTu.setText(tuThu + "/" + soLuongTu);
			}
		});
		btnNext.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				if (tuThu == soLuongTu) return;
				tuThu = tuThu + 1;				
				tuVung = "Tu vung so " + tuThu; // Lay tu databse;
				chuHan = "Chu Han so " + tuThu;  // Lay tu databse;
				nghia = "Nghia cua tu so " + tuThu;  // Lay tu databse;				
				tvTu.setText(tuVung);
				tvChuHan.setText(chuHan);
				tvNghia.setText(nghia);
				tvSoThuTu.setText(tuThu + "/" + soLuongTu);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.gkvocabdetail, menu);
		return true;
	}

}
